﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Game/GameView.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="Heritage.Codebox" %>
<%@ Import Namespace="Heritage" %>
<%@ Import Namespace="Heritage.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
<div style="display:inline-block; overflow:hidden;">
<b>Голосование</b><br /><br />
<% 
    List<GameUserData> list = ViewData.Model as List<GameUserData>;
    GameUserData gud = ViewData["UserData"] as GameUserData;
    %>
    <form name="voting" method="post" action="/Game/Vote">
    <input type="hidden" name="game" value="<%=ViewData["Game"] %>" />
    <div style="display:table-row;">
    <div style="display:table-cell; border-bottom:1px solid #D1BA8F;font-weight:bold;">Игрок</div>
    <div style="display:table-cell; border-bottom:1px solid #D1BA8F;font-weight:bold;"></div>
    <div style="display:table-cell; width:600px; border-bottom:1px solid #D1BA8F;font-weight:bold;"></div>
    <div style="display:table-cell; width: 60px;text-align:center;border-bottom:1px solid #D1BA8F;font-weight:bold;padding-left:5px; padding-right:5px; padding-bottom:10px;">Голос</div>
    <% if (gud.UserRole != Constants.STATUS_CITIZEN)
       {%>
    <div style="display:table-cell; width: 60px;text-align:center;border-bottom:1px solid #D1BA8F;font-weight:bold;padding-left:5px; padding-right:5px; padding-bottom:10px;">Спецвыбор</div>

    <%}%>
          </div>
    <%
    foreach (GameUserData gdata in list)
    { %>
    <div style="display:table-row;">
    <div style="display:table-cell; border-bottom:1px dotted #EFE7D8; padding-bottom:6px; padding-right: 24px; vertical-align:middle; "><%=gdata.UserMask %></div>
    <div style="display:table-cell; border-bottom:1px dotted #EFE7D8; padding-bottom:6px; padding-right: 24px;  vertical-align:middle; white-space:nowrap;"><%=(gdata.UserState == Constants.USERSTATE_ALIVE? "голосует за" : "вне игры") %></div>
    <div style="display:table-cell; border-bottom:1px dotted #EFE7D8;width:600px; padding-bottom:6px;  padding-right: 24px; vertical-align:middle; "><%=Utils.GetVoteMask(gdata.UserVote, ViewData["Game"] as string) %></div>
    <div style="display:table-cell; border-bottom:1px dotted #EFE7D8;width: 60px;text-align:center;  vertical-align:middle;padding-bottom:6px;">
    <% if (gdata.UserState == Constants.USERSTATE_ALIVE)
       {  %>
       <input style="margin-top:6px;" type="radio" name="vote" value="<%=gdata.UserID.ToString("N") %>"<%=(gud.UserVote == gdata.UserID?" checked":"")%>/>
    <% }
       else
       { %>
       X
    <% } %>
    </div>
    <% if (gud.UserRole != Constants.STATUS_CITIZEN)
       {%>
    <div style="display:table-cell; border-bottom:1px dotted #EFE7D8;width: 60px;text-align:center; vertical-align:middle; padding-bottom:6px;">
        <% if (gdata.UserState == Constants.USERSTATE_ALIVE)
       {  %>
       <input style="margin-top:6px;" type="radio" name="spec" value="<%=gdata.UserID.ToString("N") %>"<%=(gud.UserSpecVote == gdata.UserID?" checked":"")%>/>
    <% }
       else
       { %>
       X
    <% } %>
    </div>

    <%}%>
    </div>

    <%
    }
     %>
     <br /><br />
     <a href="#" class="awesome" onclick="document.voting.submit();return false;">Голосовать!</a>
     </form>  
     <div class="clear"></div>    
     </div>
</asp:Content>
